#ifndef WAGEEDITDIALOG_H
#define WAGEEDITDIALOG_H

#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QLineEdit>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QDialogButtonBox>
#include <QLabel>
#include <QSqlQuery>
#include <QMessageBox>
#include <QMap>
#include <QComboBox>

class WageEditDialog : public QDialog
{
    Q_OBJECT

public:
    explicit WageEditDialog(QWidget *parent = nullptr);
    
    // 设置编辑模式
    void setEditMode(bool isEdit, int wageId = -1);
    
    // 设置和获取数据
    void setWageData(const QString &toyName, double totalWage, double employeeWage, double profit);
    QString getToyName() const;
    double getTotalWage() const;
    double getEmployeeWage() const;
    double getProfit() const;
    int getWageId() const;
    
    // 加载玩具数据
    void loadToyData();

private slots:
    void validateInput();

private:
    void setupUI();
    
    // UI组件
    QComboBox *m_toyNameCombo;
    QDoubleSpinBox *m_totalWageSpin;
    QDoubleSpinBox *m_employeeWageSpin;
    QDoubleSpinBox *m_profitSpin;
    QDialogButtonBox *m_buttonBox;
    
    // 数据存储
    QMap<QString, int> m_toyMap; // toyName -> toyId
    
    // 编辑模式标识
    bool m_isEditMode;
    int m_wageId;
};

#endif // WAGEEDITDIALOG_H